﻿using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.Server;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.ADF;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.esriSystem;
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;

namespace PlanningGIS.Framework
{
    /// <summary>
    /// 
    /// </summary>
    public class MapInfo
    {
        private string m_Description;
        private IMap m_Map;
        private bool m_Expanded;
        private bool m_IsFramed;
        private esriUnits m_DistanceUnits;
        private esriUnits m_MapUnits;
        private int m_LayerCount;
        private int m_MapSurroundCount;
        private string m_Name;
        private int m_SelectionCount;
        private bool m_UseSymbolLevels;
        private double m_ReferenceScale;
        /// <summary>
        /// 
        /// </summary>
        public event OnPropertyGridValueChangedEventHandler OnPropertyGridValueChangedEvent;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pMap"></param>
        public MapInfo(IMap pMap)
        {
            m_Map = pMap;
            m_Description = pMap.Description;
            m_DistanceUnits = pMap.DistanceUnits;
            m_Expanded = pMap.Expanded;
            m_IsFramed = pMap.IsFramed;
            m_LayerCount = pMap.LayerCount;
            m_MapSurroundCount = pMap.MapSurroundCount;
            m_MapUnits = pMap.MapUnits;
            m_Name = pMap.Name;
            m_SelectionCount=pMap.SelectionCount;
            m_UseSymbolLevels=pMap.UseSymbolLevels;
            m_ReferenceScale = pMap.ReferenceScale;
        }

        /// <summary>
        /// 
        /// </summary>
        [CategoryAttribute("地图基本信息"), DefaultValueAttribute(true)]
        public string Name
        {
            get
            {
                return this.m_Name;
            }
            set
            {
                this.m_Name = value;
                this.m_Map.Name = value;
                if (OnPropertyGridValueChangedEvent != null)
                {
                    this.OnPropertyGridValueChangedEvent();
                }
            }
        }
        /// <summary>
        /// 
        /// </summary>
        [CategoryAttribute("地图基本信息"), DefaultValueAttribute(true)]
        public string Description
        {
            get
            {
                return this.m_Description;
            }
            set
            {
                this.m_Description = value;
                this.m_Map.Description = value;
                if (OnPropertyGridValueChangedEvent != null)
                {
                    this.OnPropertyGridValueChangedEvent();
                }
            }
        }

        /// <summary>
        /// 
        /// </summary>
        [CategoryAttribute("地图内容"), DefaultValueAttribute(true)]
        public int SelectionCount
        {
            get
            {
                return this.m_SelectionCount;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        [CategoryAttribute("地图内容"), DefaultValueAttribute(true)]
        public int LayerCount
        {
            get
            {
                return this.m_LayerCount;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        [CategoryAttribute("地图内容"), DefaultValueAttribute(true)]
        public int MapSurroundCount
        {
            get
            {
                return this.m_MapSurroundCount;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        [CategoryAttribute("地图显示"), DefaultValueAttribute(true)]
        public double ReferenceScale
        {
            get
            {
                return this.m_ReferenceScale;
            }
            set
            {
                this.m_ReferenceScale = value;
                this.m_Map.ReferenceScale = value;
                if (OnPropertyGridValueChangedEvent != null)
                {
                    this.OnPropertyGridValueChangedEvent();
                }
            }
        }

        /// <summary>
        /// 
        /// </summary>
        [CategoryAttribute("地图显示"), DefaultValueAttribute(true)]
        public esriUnits MapUnits
        {
            get
            {
                return this.m_MapUnits;
            }
            set
            {
                this.m_MapUnits = value;
                this.m_Map.MapUnits = value;
                if (OnPropertyGridValueChangedEvent != null)
                {
                    this.OnPropertyGridValueChangedEvent();
                }
            }
        }

        /// <summary>
        /// 
        /// </summary>
        [CategoryAttribute("地图显示"), DefaultValueAttribute(true)]
        public esriUnits DistanceUnits
        {
            get
            {
                return this.m_DistanceUnits;
            }
            set
            {
                this.m_DistanceUnits = value;
                this.m_Map.DistanceUnits = value;
                if (OnPropertyGridValueChangedEvent != null)
                {
                    this.OnPropertyGridValueChangedEvent();
                }
            }
        }

        /// <summary>
        /// 
        /// </summary>
        [CategoryAttribute("杂项"), DefaultValueAttribute(true)]
        public bool Expanded
        {
            get
            {
                return this.m_Expanded;
            }
            set
            {
                this.m_Expanded = value;
                this.m_Map.Expanded = value;
                if (OnPropertyGridValueChangedEvent != null)
                {
                    this.OnPropertyGridValueChangedEvent();
                }
            }
        }
        
        /// <summary>
        /// 
        /// </summary>
        [CategoryAttribute("杂项"), DefaultValueAttribute(true)]
        public bool Framed
        {
            get
            {
                return this.m_IsFramed;
            }
            set
            {
                this.m_IsFramed = value;
                this.m_Map.IsFramed = value;
                if (OnPropertyGridValueChangedEvent != null)
                {
                    this.OnPropertyGridValueChangedEvent();
                }
            }
        }
    }
}
